﻿@{
    ViewBag.Title = "Burndown";
    Layout = "~/Views/Shared/_Layout.cshtml";
}

@{ Html.RenderPartial("_Menu");  }

<style type="text/css">

    body {
	    margin:0;
	    padding:0;
        padding-top: 60px;
        padding-bottom: 40px;	    
    }
</style>


<div class="container">

    <h2>Burndown</h2>

    <div class="container" style="display:none" id="alerta">
           <button type="button" class="close" data-dismiss="alert">&times;</button>
          <div class="alert">
            Não foram encontradas informações para montar o gráfico, certifique-se de ter adicionado data de início e fim no quadro.
          </div>                  
      </div>

    <div id="visualization"></div>

</div>

 <script type="text/javascript" src="https://www.google.com/jsapi"></script>
    <script type="text/javascript">
        google.load("visualization", "1", {packages:["corechart"]});
        google.setOnLoadCallback(drawChart);

        function drawChart() {
            // Create and populate the data table.
            var json = @Html.Raw(ViewBag.Dados);

            if(json == null){
                document.getElementById('alerta').style.display = 'block';

            }else{
                var data = google.visualization.arrayToDataTable(json);

                // Create and draw the visualization.
                new google.visualization.LineChart(document.getElementById('visualization')).
                    draw(data,
                          { width: 900, height: 400 }
                        );
            }
        }
</script>

